import config from "@/config";
import Cookies from "js-cookie";
// base 基础
export const getCookie = (name: string) =>
  Cookies.get(`${config.projectName}-${name}`);
export const setCookie = (name: string, content: string | object) =>
  Cookies.set(`${config.projectName}-${name}`, content);
export const removeCookie = (name: string) =>
  Cookies.get(`${config.projectName}-${name}`);
// App
const sidebarStatusKey = "sidebar_status";
export const getSidebarStatus = () => getCookie(sidebarStatusKey);
export const setSidebarStatus = (sidebarStatus: string) =>
  setCookie(sidebarStatusKey, sidebarStatus);

const languageKey = "language";
export const getLanguage = () => getCookie(languageKey);
export const setLanguage = (language: string) =>
  setCookie(languageKey, language);

const sizeKey = "size";
export const getSize = () => getCookie(sizeKey);
export const setSize = (size: string) => setCookie(sizeKey, size);

// User
const tokenKey = "vue_typescript_admin_access_token";
export const getToken = () => getCookie(tokenKey);
export const setToken = (token: string) => setCookie(tokenKey, token);
export const removeToken = () => removeCookie(tokenKey);
